<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<div id="reader"></div>
</body>

<script type="text/javascript" src="../js/jquery-3.3.1.js" ></script>
<script type="text/javascript">
	
$(function() {

	$.ajax({
		type: "post",
		url: "reader",
		async: true,

		success: function(result) {
			var msg = "<table border='1px'><tr><th>新闻ID</th><th>新闻标题</th><th>作者</th><th>正文</th><th>发布日期</th></tr>";
			$.each(result, function() {
				msg += "<tr><td>" + this.newsId+"</td><td>"+this.newsTitle+ "</td><td>"+this.edit+ "</td><td>"+this.newsContent+ "</td><td>"+this.date+ "</td>";
			});
			msg+="</table>";
			$("#reader").append(msg);
		},

		error: function() {
			alert("error");
		}
	});

});

</script>

</html>